<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>构造函数</title>
	</head>
	<body>
		<script type="text/javascript">
			function person(){
//				name,age,gongzuo,zhuzhi
//				this.name=name;
//				this.age=age;
//				this.gongzuo=gongzuo;
//				this.zhuzhi=zhuzhi;
			}
			person.prototype.name="沈星星";
			person.prototype.age="24";
			person.prototype.gongzuo="无业";
			person.prototype.zhuzhi="合肥";
			person.prototype.show=function(){
//			要调用属性需要加this
			document.write("姓名："+this.name+"<br />年龄："+this.age+"<br/>工作："+this.gongzuo+"<br />住址："+this.zhuzhi);
		}
		var pers=new person();
		pers.show();
		pers.gongzuo="过段时间就有啦";
		pers.show();
		</script>
	</body>
</html>
